home *** CD-ROM | disk | FTP | other *** search
/ Aminet 50 / Aminet 50 (2002)(GTI - Schatztruhe)[!][Aug 2002].iso / Aminet / util / arc / nulib2.lha / nulib2-101 / SysDefs.h < prev   
C/C++ Source or Header  |  2001-12-12  |  4KB  |  220 lines

  1. /*
  2.  * Nulib2
  3.  * Copyright (C) 2000 by Andy McFadden, All Rights Reserved.
  4.  * This is free software; you can redistribute it and/or modify it under the
  5.  * terms of the GNU General Public License, see the file COPYING.
  6.  *
  7.  * This was adapted from gzip's "tailor.h" and NuLib's "nudefs.h".
  8.  */
  9. #ifndef __SysDefs__
  10. #define __SysDefs__
  11.  
  12. #ifdef HAVE_CONFIG_H
  13. # include <config.h>
  14. #endif
  15.  
  16. #ifdef DEBUG_VERBOSE
  17. # define DEBUG_MSGS
  18. #endif
  19.  
  20. /* these should exist everywhere */
  21. #include <stdio.h>
  22. #include <stdarg.h>
  23. #include <string.h>
  24. #ifndef _AMIGA
  25. # include <memory.h>
  26. #else
  27. # define u_char uchar
  28. # define u_long ulong
  29. # define u_int uint
  30. #endif
  31. #include <time.h>
  32. #include <errno.h>
  33. #include <assert.h>
  34.  
  35. /* basic Win32 stuff -- info-zip has much more complete defs */
  36. #if defined(WIN32) || defined(MSDOS)
  37. # define WINDOWS_LIKE
  38.  
  39. # ifndef HAVE_CONFIG_H
  40. #  define HAVE_FCNTL_H
  41. #  define HAVE_MALLOC_H
  42. #  define HAVE_STDLIB_H
  43. #  define HAVE_SYS_STAT_H
  44. #  undef HAVE_SYS_TIME_H
  45. #  define HAVE_SYS_TYPES_H
  46. #  undef HAVE_UNISTD_H
  47. #  undef HAVE_UTIME_H
  48. #  define HAVE_SYS_UTIME_H
  49. #  define HAVE_WINDOWS_H
  50. #  define HAVE_FDOPEN
  51. #  undef HAVE_FTRUNCATE
  52. #  define HAVE_MEMMOVE
  53. #  undef HAVE_MKSTEMP
  54. #  define HAVE_MKTIME
  55. #  define HAVE_SNPRINTF
  56. #  undef HAVE_STRCASECMP
  57. #  undef HAVE_STRNCASECMP
  58. #  define HAVE_STRERROR
  59. #  define HAVE_STRTOUL
  60. #  define HAVE_VSNPRINTF
  61. #  define SNPRINTF_DECLARED
  62. #  define VSNPRINTF_DECLARED
  63. #  define SPRINTF_RETURNS_INT
  64. #  define uchar unsigned char
  65. #  define ushort unsigned short
  66. #  define uint unsigned int
  67. #  define ulong unsigned long
  68. #  define inline /*Visual C++6.0 can't inline ".c" files*/
  69. #  define mode_t int
  70. # endif
  71.  
  72. # include <io.h>
  73. # define FOPEN_WANTS_B
  74. # define HAVE_CHSIZE
  75. # define snprintf _snprintf
  76. # define vsnprintf _vsnprintf
  77.  
  78. #endif
  79.  
  80.  
  81. #ifdef HAVE_MALLOC_H
  82. # include <malloc.h>
  83. #endif
  84. #ifdef HAVE_STDLIB_H
  85. # include <stdlib.h>
  86. #endif
  87. #ifdef HAVE_SYS_STAT_H
  88. # include <sys/stat.h>
  89. #endif
  90. #ifdef HAVE_SYS_TIME_H
  91. # include <sys/time.h>
  92. #endif
  93. #ifdef HAVE_SYS_TYPES_H
  94. # include <sys/types.h>
  95. #endif
  96. #ifdef HAVE_UNISTD_H
  97. # include <unistd.h>
  98. #endif
  99.  
  100. #if defined(WINDOWS_LIKE)
  101. # ifndef F_OK
  102. #  define F_OK    02
  103. # endif
  104. # ifndef R_OK
  105. #  define R_OK    04
  106. # endif
  107. #endif
  108.  
  109.  
  110. #if defined(__unix__) || defined(__unix) || defined(__BEOS__) || \
  111.     defined(__hpux) || defined(_AIX) || defined(__APPLE__)
  112. # define UNIX_LIKE
  113. #endif
  114.  
  115.  
  116. #if defined(__MSDOS__) && !defined(MSDOS)
  117. # define MSDOS
  118. #endif
  119.  
  120. #if defined(__OS2__) && !defined(OS2)
  121. # define OS2
  122. #endif
  123.  
  124. #if defined(OS2) && defined(MSDOS) /* MS C under OS/2 */
  125. # undef MSDOS
  126. #endif
  127.  
  128. /* this ought to get trimmed down */
  129. #ifdef MSDOS
  130. #  ifndef __GNUC__
  131. #    ifdef __TURBOC__
  132. #      define NO_OFF_T
  133. #      ifdef __BORLANDC__
  134. #        define DIRENT
  135. #      else
  136. #        define NO_UTIME
  137. #      endif
  138. #    else /* MSC */
  139. #      define HAVE_SYS_UTIME_H
  140. #      define NO_UTIME_H
  141. #    endif
  142. #  endif
  143. #  define PATH_SEP '\\'
  144. #  define PATH_SEP2 '/'
  145. #  define PATH_SEP3 ':'
  146. #  ifdef MAX_PATH
  147. #   define MAX_PATH_LEN MAX_PATH
  148. #  else
  149. #   define MAX_PATH_LEN 128
  150. #  endif
  151. #  define NO_MULTIPLE_DOTS
  152. #  define MAX_EXT_CHARS 3
  153. #  define NO_CHOWN
  154. #  define PROTO
  155. #  ifndef HAVE_CONFIG_H
  156. #   define STDC_HEADERS
  157. #  endif
  158. #  define NO_SIZE_CHECK
  159. #  define SYSTEM_DEFAULT_EOL "\r\n"
  160. #endif
  161.  
  162. #ifdef WIN32 /* Windows 95/98/NT */
  163. #  define HAVE_SYS_UTIME_H
  164. #  define NO_UTIME_H
  165. #  define PATH_SEP '\\'
  166. #  define PATH_SEP2 '/'
  167. #  define PATH_SEP3 ':'
  168. #  ifdef MAX_PATH
  169. #   define MAX_PATH_LEN MAX_PATH
  170. #  else
  171. #   define MAX_PATH_LEN 260
  172. #  endif
  173. #  define PROTO
  174. #  define STDC_HEADERS
  175. #  define SYSTEM_DEFAULT_EOL "\r\n"
  176. #endif
  177.  
  178. #ifdef MACOS
  179. #  define PATH_SEP ':'
  180. #  define NO_CHOWN
  181. #  define NO_UTIME
  182. #  define SYSTEM_DEFAULT_EOL "\r"
  183. #endif
  184.  
  185. #if defined(APW) || defined(__ORCAC__)
  186. #  define __appleiigs__
  187. #  pragma lint  -1
  188. #  pragma memorymodel 1
  189. #  pragma optimize 7
  190. /*#  pragma debug 25 */
  191. #  define PATH_SEP ':'
  192. #  define SYSTEM_DEFAULT_EOL "\r"
  193.  
  194. #  ifdef GNO
  195. #    define HAS_DIRENT
  196. #  endif
  197. #endif
  198.  
  199. #ifdef __GNUC__    /* this was missing from BeOS __MWERKS__, and probably others */
  200. # define HAS__FUNCTION__
  201. #endif
  202.  
  203. #if defined(__sun__) && !defined(__SVR4)
  204. # include "SunOS4.h"
  205. #endif
  206.  
  207. /* general defaults, mainly for UNIX */
  208.  
  209. #ifndef PATH_SEP
  210. # define PATH_SEP '/'
  211. #endif
  212. #ifndef SYSTEM_DEFAULT_EOL
  213. # define SYSTEM_DEFAULT_EOL "\n"
  214. #endif
  215. #ifndef MAX_PATH_LEN
  216. # define MAX_PATH_LEN    1024
  217. #endif
  218.  
  219. #endif /*__SysDefs__*/
  220.